import request from '../utils/request'

// 查看部门下拉列表@lfx
export const getDepartList = () => {
  return request.get('/system/depart/select/departList')
}

// 获取用户信息列表
export const getUserList = (userSearchDTO) => {
  return request.post('/system/authority/infoList', userSearchDTO)
}

// 获取角色类型列表
export const roleList = (index, pageSize) => {
  return request.get('system/authority/roleList', {
    params: {
      index: 1,
      pageSize: 1000
    }
  })
}

// 注册用户
export const addRole = (registerDTO) => {
  return request.post('system/authority/register', registerDTO)
}

// 获取用户信息
export const userInfo = (userId) => {
  return request.get('system/authority/info', {
    params: {
      userId
    }
  })
}

// 编辑用户信息
export const updateInfo = (registerDTO, userId) => {
  return request.post('system/authority/updateInfo', registerDTO, {
    params: {
      userId
    }
  })
}

// 删除用户信息
export const deleteUser = (userId) => {
  return request.get(`system/authority/delete?userId=${userId}`)
}

// 修改是否启用状态@lfx
export const updateStatus = (userId) => {
  return request.put(`system/authority/updateStatus/${userId}`)
}

// 查看部门列表
export const getDeparmentList = () => {
  return request.get('/system/depart/departList', {
    params: {
      index: 1,
      pageSize: 1000
    }
  })
}

// 保存部门
export const saveDepart = (name) => {
  return request.post('system/depart/saveDepart', {}, {
    params: {
      name
    }
  })
}

// 编辑部门
export const updateDepart = (id, name) => {
  return request.post('system/depart/updateDepart', {}, {
    params: {
      id,
      name
    }
  })
}

// 删除部门
export const deleteDepart = (id) => {
  return request.post('system/depart/deleteDepart', {}, {
    params: {
      id
    }
  })
}
